"""
生成测试报告的几种方式

"""
import unittest


def suite():
    testsuite = unittest.TestSuite()
    loader = unittest.TestLoader()
    tests = loader.discover(start_dir='./testcases', pattern='test*.py')
    testsuite.addTests(tests)
    return testsuite


# TextTestRunner
if __name__ == '__main__':
    suite = suite()
    with open(file='./report/report.txt', mode='a') as file:    # 日志
        runner = unittest.TextTestRunner(verbosity=2, stream=file)
        runner.run(suite)
